<?python
    from whatwhat.model import STATUS_BEHIND_SCHEDULE, status_codes, impact_codes, chance_codes
    from whatwhat.utils import textilize
    from turbogears.i18n.format import format_date
    from cgi import escape
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
    py:extends="'../master.kid'">

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>WhatWhat Status - Recent Changes</title>
	<script src="/static/javascript/master.js" type="text/javascript"></script>
	<link href="/static/css/master.css" media="screen" rel="Stylesheet" type="text/css" /> 
	<link href="/static/css/project.css" media="screen" rel="Stylesheet" type="text/css" /> 
	<link rel="alternate" type="application/rss+xml" href="${tg.url('/feed/rss2.0')}" title="RSS Feed" />
  <link rel="alternate" type="application/atom+xml" href="${tg.url('/feed/atom1.0')}" title="Atom Feed" />
</head>

<body>
    <h3>Pick a Time Frame</h3>
    
    <form id="pick_time" name="pick_time" action="change_time" method="post">
        <select name="change_hours" onchange="document.pick_time.submit()">
            <option value="24" selected="${(None, '')[int(time_hours) == 24]}">24 Hr</option>
            <option value="48" selected="${(None, '')[int(time_hours) == 48]}">48 Hr</option>
            <option value="72" selected="${(None, '')[int(time_hours) == 72]}">72 Hr</option>
        </select>
    </form>
    
    <div py:for="proj in recent_proj">
        <h3 py:if="len(proj.recent_issues) > 0 or len(proj.recent_risks) > 0 or len(proj.recent_notes) >0 or len(proj.recent_questions) >0"><a href="${tg.url('/project/%s' % proj.proj_id)}">${proj.proj_name}</a></h3>
        
        <h4 py:if="len(proj.recent_issues) > 0">Issues</h4>
        <div py:if="len(proj.recent_issues) > 0">
       	    ${issues_widget.display(issues=proj.recent_issues, read_only=True, show_closed=False)}
    	</div>
    	
        <h4 py:if="len(proj.recent_risks) > 0">Risks</h4>
        <div py:if="len(proj.recent_risks) > 0">
            ${risks_widget.display(risks=proj.recent_risks, read_only=True, show_closed=False)}
        </div>
        
        
        <h4 py:if="len(proj.recent_notes) > 0">Progress Notes</h4>
        <div id="project_notes">
            ${notes_widget.display(notes=proj.recent_notes, read_only=True)}
        </div>
        
        <h4 py:if="len(proj.recent_questions) > 0">Questions</h4>
        <div id="project_questions">
            ${questions_widget(questions=proj.recent_questions, read_only=True)}
        </div>
        
        
        <h4 py:if="len(proj.recent_files) > 0">Files</h4>
        
        <ul py:if="len(proj.recent_files) > 0" id="files">
            <li class="file" py:for="file in proj.recent_files">
                <div class="file_content">
                    <div><a href="javascript:void(0)" onclick="javascript:window.open('/static/files/$file.systemfilename', '', 'fullscreen=no,toolbar=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no')">${file.filename}</a></div>
                    <br/>
                    <div class="file_info">
                        <span>
                            Posted by <a class="file_creator" href="mailto:$file.creator.emailAddress">${file.creator.displayName}</a>
                            on ${format_date(file.creation_date, time_format=' %I:%M %p')}
                        </span>
                    </div>
                </div>
            </li>
        </ul>
        
    </div>
</body>
</html>
